//
//  BSServerController.m
//  BusinessSchool
//
//  Created by 化 on 14-6-18.
//  Copyright (c) 2014年 化. All rights reserved.
//

#import "BSServerController.h"

@interface BSServerController ()
{
    int height;
}
@end

@implementation BSServerController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"云海服务";
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(10, 0, 30, 30);
    [button setImage:[UIImage imageNamed:@"返回.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:button] autorelease];

    
    self.view.backgroundColor = [UIColor colorWithHexString:@"f0f0f0"];
    
    if (isIOS7) {
        height = 74  ;
    }else{
        height = 0;
    }
    
    NSArray *imagename = [NSArray arrayWithObjects:@"企业商店.png",@"商店网铺.png",@"剪网资讯.png", nil];
    NSArray *lablename = [NSArray arrayWithObjects:@"企业网店",@"商店网铺",@"剪网资讯", nil];
    for (int i = 0; i < 3; i++) {
        UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
        but.frame = CGRectMake(30+(i%3)*(200/3+30), 20+(i/3)*(200/3+40)+height, (200/3), 200/3);
        but.backgroundColor = [UIColor clearColor];
        [but setImage:[UIImage imageNamed:[imagename objectAtIndex:i]] forState:UIControlStateNormal];
        but.tag = i;
        [but addTarget:self action:@selector(butpress:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:but];
        
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(30+(i%3)*(200/3+30), 20+(i/3)*(200/3+40)+height+200/3, (200/3), 20)];
        label.backgroundColor = [UIColor clearColor];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = [lablename objectAtIndex:i];
        label.font = [UIFont fontWithName:@"Helvetica" size:12];
        [self.view addSubview:label];
        [label release];
        
    }
    // Do any additional setup after loading the view.
}

- (void)butpress:(UIButton*)sender
{
    int tag = sender.tag;
    if (tag == 0) {
        
    }else if (tag == 1) {
        
    }else if (tag == 2) {
        
    }else if (tag == 3) {
        
    }else if (tag == 4) {
        
    }
}


#pragma mark 返回
-(void)goBack
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
